//
// Created by zhengbo on 23-4-18.
//

#ifndef VISUALIZATION_TOOL_SCENEMANAGER_H
#define VISUALIZATION_TOOL_SCENEMANAGER_H

#include <vector>
#include <algorithm>
#include "RenderObject.h"

class SceneManager {
public:
    SceneManager() {}

    void AddObject(RenderObject* obj) {
        mObjects.push_back(obj);
    }

    void RemoveObject(RenderObject* obj) {
        mObjects.erase(std::remove(objects.begin(), objects.end(), obj), objects.end());
    }

    void UpdateObjects() {
        for (RenderObject* obj : objects) {
            obj->Update();
        }
    }

    void RenderScene() {
        for (RenderObject* obj : mObjects) {
            obj->Render();
        }
    }

    std::vector<RenderObject*> GetObjects() {
        return mObjects;
    }

private:
    std::vector<RenderObject*> mObjects;
};

#endif VISUALIZATION_TOOL_SCENEMANAGER_H

